<?php

namespace app\admin\model;

use think\Model;

/**
 * SubscribeRecord
 */
class SubscribeRecord extends Model
{
    // 表名
    protected $name = 'subscribe_record';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 字段类型转换
    protected $type = [
        'subscribe_time' => 'timestamp:Y-m-d H:i:s',
    ];


    public function order(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\SubscribeOrder::class, 'order_id', 'id');
    }

    public function stadium(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Stadium::class, 'stadium_id', 'id');
    }

    public function user(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\User::class, 'user_id', 'id');
    }
}